package com.example.gxwmvp;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.ListView;

import com.example.gxwmvp.bean.Girls;
import com.example.gxwmvp.presenter.GirlPresenter;
import com.example.gxwmvp.view.IGirlViewInterface;

import java.util.List;

public class MainActivity extends BaseActivity<IGirlViewInterface,GirlPresenter<IGirlViewInterface>> implements IGirlViewInterface {
    String TAG = "MainActivity";
    ListView listView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        listView = this.findViewById(R.id.lvGirl);
        mPresenter.fetch();
    }

    @Override
    protected GirlPresenter<IGirlViewInterface> createPresenter() {
        mPresenter = new GirlPresenter();
        return mPresenter;
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

    //VIEW层的加载进度框
    @Override
    public void showLoading() {

        Log.i(TAG,"showLoading");

    }

    //VIEW层显示数据，数据是由mode层已经提供好的
    @Override
    public void showList(List<Girls> girlsList) {
        Log.i(TAG,"showList");
        listView.setAdapter(new GirlsAdapter(this,girlsList));

    }
}
